package com.woniuxy.controller;

import com.woniuxy.bean.ResultDto;
import com.woniuxy.pojo.Dept;
import javafx.scene.chart.ValueAxis;
import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class DeptController {
    private Logger logger=Logger.getLogger(this.getClass());
    @GetMapping(value = "/depts")
    public ResultDto findAll(){
        logger.info("===查询所有的部门信息===");
        return null;
    }
    @PostMapping(value = "/depts")
    public ResultDto addDept(Dept dept){
        logger.info("==增加部门信息==");
        ResultDto resultDto=new ResultDto();
        resultDto.setCode(200);
        resultDto.setMsg("增加部门成功");
        Dept resultDept=new Dept();
        resultDept.setId(1);
        resultDept.setDname("技术部");
        resultDto.setData(resultDept);
        return resultDto;
    }
    @DeleteMapping(value = "/depts/{id}")
    public ResultDto deleteDept(@PathVariable("id") Integer id){
        logger.info("===删除部门信息====");
        return null;
    }
    @PutMapping(value = "/depts/{id}")
    public ResultDto updateDept(@RequestBody Dept dept,@PathVariable("id")Integer id){
        logger.info("====修改部门信息=====");
        logger.info("=====按ID查询部门==========");
        logger.info("获取的id为:"+id);
        logger.info("获取的部门的名称:"+dept.getDname());
        return null;
    }
    @GetMapping(value = "/depts/{id}")
    public ResultDto selectDeptById(@PathVariable("id") Integer id){
        logger.info("=====按ID查询部门==========");
        logger.info("获取的id为:"+id);
        return null;
    }

}
